Skip to content

feat: generate backend environment template - #10

Open
teleginzhenya wants to merge 1 commit into
mainfrom
feat/generate-env-template
Open

feat: generate backend environment template#10
teleginzhenya wants to merge 1 commit into
mainfrom
feat/generate-env-template

Conversation

@teleginzhenya

@teleginzhenya teleginzhenya commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • generate .env-template with APP_DEV_MODE=true for scaffolded backend projects
  • document copying the template to .env and the resulting human-readable NodeKit logs
  • omit the environment file and setup instructions from projects without a backend
  • document the generated file in the project structure
  • cover backend and non-backend generation with unit tests

Testing

  • npm test (86 tests)
  • npx tsc --noEmit
  • npm run lint -- --fix
  • npm run lint:prettier
  • npm run knip
  • npm run build
  • built CLI scaffold smoke test

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Summary by Sourcery

Generate a backend environment template and document its usage in scaffolded projects.

New Features:

  • Include a .env-template file in backend NodeKit projects to enable readable development logs.

Enhancements:

  • Pass backend presence into README rendering and document environment setup only for backend projects.
  • Update top-level README and readme script to describe the generated .env-template in the project structure.

Tests:

  • Add generator tests covering README environment documentation and .env-template creation/omission for backend and non-backend projects.

@teleginzhenya
teleginzhenya requested a review from ogonkov as a code owner July 29, 2026 11:57
@sourcery-ai

sourcery-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR updates the scaffolding generators to create a backend-only .env-template with APP_DEV_MODE=true, wires that into the generated README documentation and overall project structure docs, and adds unit tests to cover both backend and non-backend flows.

File-Level Changes

Change Details Files
Generate a backend-specific .env-template file and ensure it is only present for projects with a backend.
  • Import a new .env-template Handlebars template in the NodeKit generator.
  • Write .env-template to the project root during NodeKit generation when a backend is present.
  • Add tests to assert .env-template is omitted for non-backend projects and present with correct contents for backend projects.
  • Create the .env-template.hbs template with APP_DEV_MODE=true as its contents.
src/generators/nodekit.ts
src/generators/nodekit.test.ts
src/generators/templates/.env-template.hbs
Update generated README content to document environment setup only for backend projects.
  • Update base README Handlebars template to conditionally render an Environment section when hasBackend is true.
  • Change base generator to pass hasBackend into the README renderer.
  • Add tests verifying backend README includes .env-template copy instructions and APP_DEV_MODE=true, and non-backend README omits environment setup.
src/generators/templates/README.md.hbs
src/generators/base.ts
src/generators/base.test.ts
Document the .env-template file and environment behavior in the main project-level README and script-generated README.
  • Add .env-template to the project tree examples with a note that it is only generated when a backend is present.
  • Add prose explaining that backend projects include .env-template, that it should be copied to .env, and that APP_DEV_MODE=true enables human-readable, colorized NodeKit logs.
README.md
scripts/readme/readme.hbs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In generateNodekit, consider guarding the .env-template write with model.hasBackend so that it’s only created for backend-enabled projects, which would better align with the README comments and the new test that expects no .env-template when there is no backend.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `generateNodekit`, consider guarding the `.env-template` write with `model.hasBackend` so that it’s only created for backend-enabled projects, which would better align with the README comments and the new test that expects no `.env-template` when there is no backend.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant